/*
 * F9.c
 *
 *  Created on: 21/10/2012
 *      Author: Sarah
 */

#include "F9.h"

double F9minX = -100;
double F9maxX = 100;
int F9dimensions = 1000;

int nonSeparableGroupSize = 50;



double compute(double*x) {
	int k, i;
	double result = 0.0;

	double*Ovector = createShiftVector(F9dimensions, F9minX, F9maxX);
	int* Pvector = createPermVector(F9dimensions);
	double*RotMatrix = createRotMatrix1D(nonSeparableGroupSize);
	double* F9anotherz = malloc(sizeof(double) * F9dimensions);

	for (i = 0; i < F9dimensions; i++) {
		F9anotherz[i] = x[i] - Ovector[i];
	}

	for (k = 1; k <= F9dimensions / (2 * nonSeparableGroupSize); k++) {
		result += rot_elliptic2(F9anotherz, nonSeparableGroupSize, k);
	}

	result += elliptic2(F9anotherz, F9dimensions, 2);

	return (result);
}

int F9GetF9dimensionss() {
	return F9dimensions;
}
double F9GetGetMax() {
	return F9maxX;
}
double F9GetMin() {
	return F9minX;
}
